package fr.mywiki.view.web.struts.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;

/**
 * Enables the display of error messages inside (not main) pages, such as research or log.
 * 
 * @author tlombard
 */
public abstract class ErrorMessageForm extends ActionForm {
	private static final long serialVersionUID = 1L;

	public void setErrorMessage(HttpServletRequest request, String errorMessage) {
		request.setAttribute(getErrorAttributeName(), errorMessage);
	}
	
	/**
	 * Returns the name of the attribute which contains the error message which is in the request.
	 */
	public abstract String getErrorAttributeName();
}
